import os

# 项目根目录
root_dir = "/home/yajun/projects/project_name/"

# 定义目录结构
directories = [
    os.path.join(root_dir, "configs"),
    os.path.join(root_dir, "configs", "default.yaml"),
    os.path.join(root_dir, "configs", "high_coverage.yaml"),
    os.path.join(root_dir, "templates"),
    os.path.join(root_dir, "templates", "sby_template.j2"),
    os.path.join(root_dir, "templates", "report_template.html.j2"),
    os.path.join(root_dir, "src"),
    os.path.join(root_dir, "properties"),
    os.path.join(root_dir, "scripts"),
    os.path.join(root_dir, "results"),
    os.path.join(root_dir, "reports")
]

for path in directories:
    # 确保父目录存在
    dirname = os.path.dirname(path)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname, exist_ok=True)
    
    # 判断是否为文件路径（通过文件名是否包含扩展名）
    if "." in os.path.basename(path):
        # 创建空文件（如果不存在）
        if not os.path.exists(path):
            with open(path, 'w') as f:
                pass
    else:
        # 创建目录（如果不存在）
        os.makedirs(path, exist_ok=True)

print("目录和文件已成功创建。")